package com.hliushi.chain.example01_right;

/**
 * @author: hliushi
 * @date: 2023/2/16 22:14
 **/
public class _Client {

    public static void main(String[] args) {
        // Approver fightJoin = new Staff("张飞");
        // // 此处使用链式编程配置责任链
        // fightJoin.setNextApprover(new Manger("关羽"))
        //         .setNextApprover(new CFO("刘备"));

        // 使用工厂创建审批人流程
        Approver fightJoin = approverFactory();

        fightJoin.approve(10990);
        System.out.println("\n---------------------------------------");

        fightJoin.approve(3800);
        System.out.println("\n---------------------------------------");

        fightJoin.approve(7000);
        System.out.println("\n---------------------------------------");
    }

    private static Approver approverFactory() {
        Approver fightJoin = new Staff("张飞");
        // 此处使用链式编程配置责任链
        fightJoin.setNextApprover(new Manger("关羽"))
                .setNextApprover(new CFO("刘备"));
        return fightJoin;
    }
}
